package com.ji.TestZookeeper.curator;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;

public class ClientFactory {
	public static CuratorFramework newClient() {
		CuratorFramework client = CuratorFrameworkFactory.builder().connectString("172.171.51.151:2181")
				.sessionTimeoutMs(30000).connectionTimeoutMs(30000).canBeReadOnly(false)
				.retryPolicy(new ExponentialBackoffRetry(1000, Integer.MAX_VALUE)).namespace("testlock")
				.defaultData(null).build();
		return client;
	}

	public static CuratorFramework newClient2() {
		CuratorFramework client = CuratorFrameworkFactory.builder().connectString("172.171.51.151:2182")
				.sessionTimeoutMs(30000).connectionTimeoutMs(30000).canBeReadOnly(false)
				.retryPolicy(new ExponentialBackoffRetry(1000, Integer.MAX_VALUE)).namespace("testlock")
				.defaultData(null).build();
		return client;
	}
}
